package com.lg.dborder2;

import com.lg.dborder2.mapper.CountryMapper;
import com.lg.dborder2.model.Country;
import com.lg.dborder2.utils.CommonUtil;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.io.DataInputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

// reademe https://github.com/abel533/MyBatis-Spring-Boot
@SpringBootApplication
@Slf4j
//public class Order2Application implements CommandLineRunner {
public class Order2Application {
	@Autowired
	private CountryMapper countryMapper;

	public static void main(String[] args) throws IOException {
		log.info("启动");
		log.info("runend{}","listlist");

		Mobile needtype = CommonUtil.nameOf(Mobile.class,"Samsung");
		log.info("lgthis{}",needtype.toString());
		//一般是为了name
		log.info("money1:{}",needtype.price);
		log.info("money2:{}",needtype.showPrice());
		SpringApplication.run(Order2Application.class, args);
		Object obj = new Object();


		/// 第一种：最最原始的io,尽量不要用
		new MainFrame();
		/// 第二种 JDK 的NIO 复杂的一笔，自己写说不定有BUG
		//new NIOServer();
		// 第三种 直接上netty
		//new NettyServer();

	}

//	@Override
//	public void run(String... args) throws Exception {
//		//List<Country> list = countryMapper.selectAll();
//		//log.info("runend{}",list.toString());
//		log.info("runend{}","listlist"); //这里面打log不醒呢
//
//		//Type needtype = CommonUtil.nameOf(Type.class,"ONE");
//		//log.info("lgthis{}",needtype.toString());
//		log.info("end");
//	}

	enum Mobile {
		Samsung(400), Nokia(250),Motorola(325);

		int price;
		Mobile(int p) {
			price = p;
		}
		int showPrice() {
			return price;
		}
	}




}
